package com.df.bpm.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.df.bpm.entity.BusinessInformation;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface BusinessInformationMapper extends BaseMapper<BusinessInformation> {
    @Select("select bo.businessEntityIndex as outputsId \n" +
            "from businessOverview.businessLocations bl \n" +
            "LEFT JOIN businessOverview.businessOutputs bo ON bo.businessInformationIndex=bl.businessInformationIndex\n" +
            "where bl.superior=#{superior} and bo.businessEntityIndex is not null ")
    List<Integer> getSonsOutputs(Integer superior);

    @Select("select bi.businessEntityIndex as inputsId \n" +
            "from businessOverview.businessLocations bl \n" +
            "LEFT JOIN businessOverview.businessInputs bi ON bi.businessInformationIndex=bl.businessInformationIndex\n" +
            "where bl.superior=#{superior} and bi.businessEntityIndex is not null ")
    List<Integer> getSonsInputs(Integer superior);

    @Select("select businessEntityIndex \n" +
            "from businessOverview.businessOutputs  \n" +
            "where businessInformationIndex=#{businessInformationIndex}")
    List<Integer> getOutputs(Integer businessInformationIndex);

    @Select("select businessEntityIndex \n" +
            "from businessOverview.businessInputs  \n" +
            "where businessInformationIndex=#{businessInformationIndex}")
    List<Integer> getInputs(Integer businessInformationIndex);
}